package com.mario.consumer.controller;

import com.mario.consumer.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/findOne/{id}")
    public User findOne(@PathVariable("id") Integer id) {
        System.out.println("id....." + id);

        String url = "http://localhost:8080/User/findOne/1";

        User forObject = restTemplate.getForObject(url, User.class);

        return forObject;
    }
}
